using System;  
using System.Net;  
using System.Net.Sockets; 
using System.Text;
    
namespace Demo  
{  
    class Program  
    {  
       static void Main()  
       {  
			int port = 24242; //as opposed to the default 42424 :)  
			IPEndPoint endPoint = new IPEndPoint(IPAddress.Any, port);  
   			Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream,ProtocolType.Tcp);  
   			server.Bind(endPoint);  
   			server.Listen(20);  
   			Socket clientHandler = server.Accept();  
   			byte[] transmission = new byte[1024];  
   			while(true)
			{
				clientHandler.Receive(transmission);  
    			clientHandler.Send(transmission);
  				//print transmitted data  
  				Console.WriteLine(Encoding.Default.GetString(transmission));  
			}
  				Console.ReadKey();  
       }  
    }  
}  